import json
import urllib.request

url = 'https://movie.douban.com/j/chart/top_list?type=25&interval_id=100%3A90&action=&start=0&limit=20'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 '
                  '(KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0'
}
request = urllib.request.Request(url, headers=headers)
response = urllib.request.urlopen(request)
decode = response.read().decode('utf-8')
loads = json.loads(decode)
print(loads)
for i in loads:
    print(i['title'])
fp = open('douban.json', 'w', encoding='utf-8')
fp.write(decode)
fp.close()
